Pain > (Vicarious & Cognitive) cue

Pain > VC :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0001.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defaults instead.
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0001.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 25558272 bytes Loading image number: 64 Elapsed time is 146.780808 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 6172039 Bit rate: 22.56 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

Pain > VC :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 06:23:02 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Pain > VC :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 3 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 32.81% Expected 3.20 outside 95% ellipsoid, found 6 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 33 Uncorrected: 6 images Cases 2 24 26 33 38 50 Retained 7 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 51.56% Expected 3.20 outside 95% ellipsoid, found 1 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 1 images Cases 53 Mahalanobis (cov and corr, q<0.05 corrected): 1 images Outlier_count Percentage _____________ __________ global_mean 1 1.5625 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 2 3.125 mahal_cov_uncor 6 9.375 mahal_cov_corrected 1 1.5625 mahal_corr_uncor 1 1.5625 mahal_corr_corrected 0 0 Overall_uncorrected 7 10.938 Overall_corrected 2 3.125
SPM12: spm_check_registration (v7759) 06:23:43 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 64×1 logical array
0 1 0 0 0 0 0 0 0 0
wh_outlier_corr = 64×1 logical array
0 0 0 0 0 0 0 0 0 0

Pain > VC :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Pain > VC :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 64
%for s = 1:length(wh_outlier_corr)
%disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [64×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0001.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [62×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0001.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [62×109 char] files_exist: [62×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0001.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 2 participants, size is now 62

Pain > VC :: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Pain > VC :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 06:23:49 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.021749 Image 1 66 contig. clusters, sizes 1 to 41064 Positive effect: 38563 voxels, min p-value: 0.00000000 Negative effect: 4865 voxels, min p-value: 0.00000000
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 06:23:51 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×66 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 1169 voxels displayed, 42259 not displayed on these slices
sagittal montage: 1208 voxels displayed, 42220 not displayed on these slices
sagittal montage: 1149 voxels displayed, 42279 not displayed on these slices
axial montage: 8138 voxels displayed, 35290 not displayed on these slices
axial montage: 8924 voxels displayed, 34504 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

Vicarious > (Pain & Cognitive) cue

clear all

Vicarious > PC :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0002.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii Direct calls to spm_defauts are deprecated. Please use spm('Defaults',modality) or spm_get_defaults instead.
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0002.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 25558272 bytes Loading image number: 64 Elapsed time is 150.217078 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 6170602 Bit rate: 22.56 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

Vicarious > PC :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 06:26:51 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Vicarious > PC :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 3 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 32.81% Expected 3.20 outside 95% ellipsoid, found 5 Potential outliers based on mahalanobis distance: Bonferroni corrected: 2 images Cases 2 38 Uncorrected: 5 images Cases 2 24 33 38 41 Retained 9 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 48.44% Expected 3.20 outside 95% ellipsoid, found 1 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 1 images Cases 29 Mahalanobis (cov and corr, q<0.05 corrected): 2 images Outlier_count Percentage _____________ __________ global_mean 4 6.25 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 2 3.125 mahal_cov_uncor 5 7.8125 mahal_cov_corrected 2 3.125 mahal_corr_uncor 1 1.5625 mahal_corr_corrected 0 0 Overall_uncorrected 6 9.375 Overall_corrected 2 3.125
SPM12: spm_check_registration (v7759) 06:27:34 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 64×1 logical array
0 1 0 0 0 0 0 0 0 0
wh_outlier_corr = 64×1 logical array
0 1 0 0 0 0 0 0 0 0

Vicarious > PC :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Vicarious > PC :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 64
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [64×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0002.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [62×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0002.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [62×109 char] files_exist: [62×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0002.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 2 participants, size is now 62

Vicarious > PC :: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Vicarious > PC :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 06:27:40 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.008748 Image 1 118 contig. clusters, sizes 1 to 4282 Positive effect: 5987 voxels, min p-value: 0.00000000 Negative effect: 11483 voxels, min p-value: 0.00000000
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 06:27:42 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×118 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 469 voxels displayed, 17001 not displayed on these slices
sagittal montage: 636 voxels displayed, 16834 not displayed on these slices
sagittal montage: 493 voxels displayed, 16977 not displayed on these slices
axial montage: 3412 voxels displayed, 14058 not displayed on these slices
axial montage: 3693 voxels displayed, 13777 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

Cognitive > (Pain & Vicarious) cue

Cognitive > PV :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0003.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0003.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 25558272 bytes Loading image number: 64 Elapsed time is 145.627970 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 6162522 Bit rate: 22.56 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

Cognitive > PV :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 06:30:43 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

Cognitive > PV :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 3 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 39.06% Expected 3.20 outside 95% ellipsoid, found 4 Potential outliers based on mahalanobis distance: Bonferroni corrected: 2 images Cases 24 38 Uncorrected: 4 images Cases 24 33 38 43 Retained 10 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 51.56% Expected 3.20 outside 95% ellipsoid, found 3 Potential outliers based on mahalanobis distance: Bonferroni corrected: 0 images Cases Uncorrected: 3 images Cases 10 51 64 Mahalanobis (cov and corr, q<0.05 corrected): 2 images Outlier_count Percentage _____________ __________ global_mean 1 1.5625 global_mean_to_variance 0 0 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 2 3.125 mahal_cov_uncor 4 6.25 mahal_cov_corrected 2 3.125 mahal_corr_uncor 3 4.6875 mahal_corr_corrected 0 0 Overall_uncorrected 7 10.938 Overall_corrected 2 3.125
SPM12: spm_check_registration (v7759) 06:31:13 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 64×1 logical array
0 0 0 0 0 0 0 0 0 1
wh_outlier_corr = 64×1 logical array
0 0 0 0 0 0 0 0 0 0

Cognitive > PV :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

Cognitive > PV :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 64
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [64×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0003.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [62×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0003.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×62 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [62×12 char] fullpath: [62×109 char] files_exist: [62×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0003.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 2 participants, size is now 62

Cognitive > PV:: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

Cognitive > PV :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 06:31:18 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.018056 Image 1 79 contig. clusters, sizes 1 to 34641 Positive effect: 3187 voxels, min p-value: 0.00000000 Negative effect: 32868 voxels, min p-value: 0.00000000
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 06:31:20 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×79 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 1024 voxels displayed, 35031 not displayed on these slices
sagittal montage: 886 voxels displayed, 35169 not displayed on these slices
sagittal montage: 1036 voxels displayed, 35019 not displayed on these slices
axial montage: 6726 voxels displayed, 29329 not displayed on these slices
axial montage: 7369 voxels displayed, 28686 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;

General cue

General :: load dataset

mount_dir = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel';
con_list = dir(fullfile(mount_dir, '*/con_0004.nii'));
spm('Defaults','fMRI')
con_fldr = {con_list.folder}; fname = {con_list.name};
con_files = strcat(con_fldr,'/', fname)';
con_data_obj = fmri_data(con_files);
Using default mask: /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/brainmask_canlab.nii
sampleto = '/Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0004.nii'
loading mask. mapping volumes. checking that dimensions and voxel sizes of volumes are the same. Pre-allocating data array. Needed: 25558272 bytes Loading image number: 64 Elapsed time is 171.127446 seconds. Image names entered, but fullpath attribute is empty. Getting path info. Number of unique values in dataset: 6165497 Bit rate: 22.56 bits
contrast_name = {'cue_P', 'cue_V', 'cue_C', 'cue_G',...
'cueXcue_P', 'cueXcue_V', 'cueXcue_C', 'cueXcue_G',...
'stim_P', 'stim_V', 'stim_C', 'stim_G',...
'stimXcue_P', 'stimXcue_V', 'stimXcue_C', 'stimXcue_G',...
'motor', ...
'simple_cue_P', 'simple_cue_V', 'simple_cue_C',...
'simple_cueXcue_P', 'simple_cueXcue_V', 'simple_cueXcue_C', ...
'simple_stim_P', 'simple_stim_V', 'simple_stim_C',...
'simple_stimXcue_P', 'simple_stimXcue_V', 'simple_stimXcue_C'};

General :: check data coverage

m = mean(con_data_obj);
m.dat = sum(~isnan(con_data_obj.dat) & con_data_obj.dat ~= 0, 2);
orthviews(m, 'trans') % display
SPM12: spm_check_registration (v7759) 06:34:43 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
ans = 1×1 cell array
{1×1 region}

General :: Plot diagnostics, before l2norm

drawnow; snapnow
[wh_outlier_uncorr, wh_outlier_corr] = plot(con_data_obj)
______________________________________________________________ Outlier analysis ______________________________________________________________ global mean | global mean to var | spatial MAD | Missing values | 0 images Retained 5 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 31.25% Expected 3.20 outside 95% ellipsoid, found 8 Potential outliers based on mahalanobis distance: Bonferroni corrected: 1 images Cases 24 Uncorrected: 8 images Cases 1 2 4 9 12 24 39 47 Retained 21 components for mahalanobis distance Expected 50% of points within 50% normal ellipsoid, found 40.62% Expected 3.20 outside 95% ellipsoid, found 7 Potential outliers based on mahalanobis distance: Bonferroni corrected: 2 images Cases 11 55 Uncorrected: 7 images Cases 3 11 35 51 55 60 63 Mahalanobis (cov and corr, q<0.05 corrected): 3 images Outlier_count Percentage _____________ __________ global_mean 1 1.5625 global_mean_to_variance 1 1.5625 missing_values 0 0 rmssd_dvars 0 0 spatial_variability 0 0 mahal_cov_uncor 8 12.5 mahal_cov_corrected 1 1.5625 mahal_corr_uncor 7 10.938 mahal_corr_corrected 2 3.125 Overall_uncorrected 15 23.438 Overall_corrected 3 4.6875
SPM12: spm_check_registration (v7759) 06:35:12 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 (all) /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1 /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
Grouping contiguous voxels: 1 regions
wh_outlier_uncorr = 64×1 logical array
1 1 1 1 0 0 0 0 1 0
wh_outlier_corr = 64×1 logical array
0 0 0 0 0 0 0 0 0 0

General :: run robfit

set(gcf,'Visible','on')
figure ('Visible', 'on');
drawnow, snapnow;

General :: remove outliers based on plot

con = con_data_obj;
disp(strcat("current length is ", num2str(size(con_data_obj.dat,2))))
current length is 64
%for s = 1:length(wh_outlier_corr)
% disp(strcat("-------subject", num2str(s), "------"))
con.dat = con_data_obj.dat(:,~wh_outlier_corr);
con.image_names = con_data_obj.image_names(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×61 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [61×12 char] fullpath: [64×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0004.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.fullpath = con_data_obj.fullpath(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×61 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [61×12 char] fullpath: [61×109 char] files_exist: [64×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0004.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
con.files_exist = con_data_obj.files_exist(~wh_outlier_corr,:)
con =
fmri_data with properties: source_notes: 'Info about image source here' X: [] mask: [1×1 fmri_mask_image] mask_descrip: 'REMOVED: CHANGED SPACE' images_per_session: [] Y: [] Y_names: [] Y_descrip: 'Behavioral or outcome data matrix.' covariates: [] covariate_names: {''} covariates_descrip: 'Nuisance covariates associated with data' history_descrip: 'Cell array of names of methods applied to this data, in order' additional_info: [0×0 struct] metadata_table: [0×0 table] dat: [99837×61 single] dat_descrip: [] volInfo: [1×1 struct] removed_voxels: 0 removed_images: 0 image_names: [61×12 char] fullpath: [61×109 char] files_exist: [61×1 logical] history: {'' 'Sampled to space of /Volumes/spacetop_projects_social/analysis/fmri/spm/univariate/model-02_CcEScA/1stLevel/sub-0003/con_0004.nii' 'Masked with REMOVED: CHANGED SPACE' 'Checked image files exist. All exist = 1'}
%end
disp(strcat("after removing ", num2str(sum(wh_outlier_corr)), " participants, size is now ",num2str(size(con.dat,2))))
after removing 3 participants, size is now 61

General: plot diagnostics, after l2norm

imgs2 = con.rescale('l2norm_images');

General :: ttest

t = ttest(imgs2);
One-sample t-test Calculating t-statistics and p-values
orthviews(t)
SPM12: spm_check_registration (v7759) 06:35:16 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×1 struct}
drawnow, snapnow;
fdr_t = threshold(t, .05, 'fdr');
Image 1 FDR q < 0.050 threshold is 0.036113 Image 1 24 contig. clusters, sizes 1 to 71908 Positive effect: 61918 voxels, min p-value: 0.00000000 Negative effect: 10195 voxels, min p-value: 0.00000000
orthviews(fdr_t)
SPM12: spm_check_registration (v7759) 06:35:17 - 26/05/2022 ======================================================================== Display /Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img,1
ans = 1×1 cell array
{1×24 struct}
drawnow, snapnow;
create_figure('montage'); axis off
montage(fdr_t)
Setting up fmridisplay objects
sagittal montage: 1657 voxels displayed, 70456 not displayed on these slices
sagittal montage: 1719 voxels displayed, 70394 not displayed on these slices
sagittal montage: 1632 voxels displayed, 70481 not displayed on these slices
axial montage: 13376 voxels displayed, 58737 not displayed on these slices
axial montage: 14696 voxels displayed, 57417 not displayed on these slices
ans =
fmridisplay with properties: overlay: '/Users/h/Documents/MATLAB/CanlabCore/CanlabCore/canlab_canonical_brains/Canonical_brains_surfaces/keuken_2014_enhanced_for_underlay.img' SPACE: [1×1 struct] activation_maps: {[1×1 struct]} montage: {[1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct] [1×1 struct]} surface: {} orthviews: {} history: {} history_descrip: [] additional_info: ''
drawnow, snapnow;